<?php
include ("../inc/config.inc.php");
include ("../inc/mysql.inc.php");
include ("inc/tool.inc.php");
// 判断$_get传值是否正常
$url = "father_module.php";
if (!isset($_GET['id']) || !is_numeric($_GET['id'])) {
    skip($url,'error','传递的父板块id值不存在或无法识别');
}
$link = connect();
$select_son = "select * from sfk_son_module where father_module_id = {$_GET['id']}";
$son = execute($link,$select_son);
if ($son->num_rows) {
    skip($url,'error','该父板块下存在其它子版块，请确保该父板块下无子版块后再删除');
}
$query = "delete from sfk_father_module where id = {$_GET['id']}";
execute($link,$query);
if ($link->affected_rows == 1) {
    skip($url, 'error', '删除父板块成功');
} else {
    skip($url, 'error', '删除父板块失败');
}

